Carbon


SndDoubleBackProcPtr

Header: Sound.h Carbon status: Supported

Defines a pointer to a doubleback callback function. Your doubleback function customizes the double buffering of sound during a play from disk.

typedef void(* SndDoubleBackProcPtr) (
    SndChannelPtr channel, 
    SndDoubleBufferPtr doubleBufferPtr
);

You would declare your function like this if you were to name it MySndDoubleBackCallback:

void MySndDoubleBackCallback (
    SndChannelPtr channel, 
    SndDoubleBufferPtr doubleBufferPtr
);
Parameter descriptions
channel

A pointer to a sound channel on which a play from disk is executing.

doubleBufferPtr

A pointer to a sound double buffer structure

DISCUSSION

If you wish to customize the double buffering of sound during a play from disk, you must use the SndPlayDoubleBuffer function and define a doubleback function.

Doubleback functions give you the power to modify sampled-sound data immediately before the Sound Manager plays it. The Sound Manager calls the doubleback function associated with a play from disk whenever the Sound Manager has exhausted the buffer. As the doubleback function refills the buffer, the Sound Manager plays the other buffer. Your application might also call the doubleback function twice to fill both buffers before the initial call to SndPlayDoubleBuffer function.

When your doubleback function is called, it must

If your doubleback function fills the buffer with the last frames of sound that need to be played, then your function should set the dbLastBuffer bit of the dbFlags field of the sound double buffer structure.

Your doubleback function might fill the buffer with data from any of several sources. For example, the doubleback function might compute the data, copy it from elsewhere in RAM, or read it from disk. A doubleback function can also read data from disk and then modify the data. This might be useful, for example, if you would like the Sound Manager to be able to play sampled-sound data stored in 16-bit binary offset format. Your doubleback function could translate the data to the 8-bit binary offset format that the Sound Manager can read before placing it in the buffer.

SPECIAL CONSIDERATIONS

A doubleback function is called at interrupt time. It must not make any calls to the Memory Manager, either directly or indirectly. If your callback function needs to access your application’s global variables, you must ensure that register A5 contains your application’s A5. (You can use one of the two long integers in the dbUserInfo field of the sound double buffer structure specified by the exhaustedBuffer parameter to pass that value to your callback function.)


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)